package view;

import model.Model;
import model.item.Inventory;

public class InventoryListProvider extends ListProvider {
	private Inventory inventory;
	
	/**
	 * Constructor for InventoryListProvider.  This class is intended for the Avatar's inventory although
	 * all entities can theoretically have a ListProvider for their inventory.  Which can be useful for implementing
	 * trading. 
	 */
	public InventoryListProvider(Inventory inventory ) {
		this.inventory = inventory;
		inventory.register(this);
		this.update(inventory);
	}
	
	public void update ( Model m ) {
		clearModelToList();
		for (Model item : inventory.getItems()){//getBc().getInventoryItems()) {
			addModelToList(item);
		}
		updateSubscribers();//controller will load new listeners
		notifyListOverlays();
		//this.invalidateImg();//it will be re-drawn form scratch next time
	}
}
